package expressoes;

import java.util.HashMap;
import java.util.Vector;

public class Variavel extends Atomica {

	public Variavel(String str) {
		super(str);
	}

	@Override
	public Vector<String> getSubExpressoes() {
		Vector<String> sub = new Vector<String>();
		sub.add(getExpressao());
		return sub;
	}

	@Override
	public String calcula(HashMap<String, String> hash) {
		
		if(!hash.containsKey(getExpressao())){
			// ERROR
		}
		
		return hash.get(getExpressao());
	}

	@Override
	public HashMap<String, String> calculaSubExpressoes(
			HashMap<String, String> hash) {
		
		if(!hash.containsKey(getSubExpressoes())){
			hash.put(getExpressao(), calcula(hash));
		}
		
		return hash;
	}

}
